<?php /* SVN: $Id: admin_index.ctp 2873 2010-08-27 10:43:10Z sakthivel_135at10 $ */ ?>
<div class="projectRatings index js-response">


	
<div class="page-count-block clearfix">
    <div class="grid_left">
        <?php
         if(empty($this->request->params['named']['view_type'])) :
            echo $this->element('paging_counter');
         endif;
        ?>
    </div>

    <div class="grid_left">
        <?php if(empty($this->request->params['named']['view_type'])) : ?>
            <?php echo $this->Form->create('ProjectRating' , array('type' => 'get', 'class' => 'normal search-form  clearfix','action' => 'index')); ?>
        	<div class="filter-section clearfix">
        			<?php echo $this->Form->input('q', array('label' => __l('Keyword'))); ?>

        			<?php echo $this->Form->submit(__l('Search'));?>
        	</div>
        	<?php echo $this->Form->end();
      endif;
    		?>
    </div>
</div>
<?php echo $this->Form->create('ProjectRating' , array('class' => 'normal clearfix','action' => 'update')); ?>
    <?php echo $this->Form->input('r', array('type' => 'hidden', 'value' => $this->request->url)); ?>

    <table class="list">
        <tr>
            <?php if(empty($this->request->params['named']['view_type'])) :?>
            <th class="select"><?php echo __l('Select'); ?></th>
            <?php endif; ?>
            <th class="actions"><?php echo __l('Actions');?></th>
			<?php if(empty($this->request->params['named']['view_type'])) : ?>
            <th class="dl"><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Project'), 'Project.name');?></div></th>
			<?php endif; ?>
            <th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('User'), 'User.username');?></div></th>
            <th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Voting'),'rating');?></div></th>
            <th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Voted on'), 'created');?></div></th>
        </tr>
        <?php
         if (!empty($projectRatings)):
            $i = 0;
            foreach ($projectRatings as $projectRating):
                $class = null;
                if ($i++ % 2 == 0) :
                    $class = ' class="altrow"';
                endif;
                ?>
                <tr<?php echo $class;?>>
                <?php if(empty($this->request->params['named']['view_type'])) :?>
                <td class="select"><?php echo $this->Form->input('ProjectRating.'.$projectRating['ProjectRating']['id'].'.id', array('type' => 'checkbox', 'id' => "admin_checkbox_".$projectRating['ProjectRating']['id'], 'label' => false, 'class' => 'js-checkbox-list')); ?></td>
                <?php endif; ?>
                    <td class="actions dl">
                        <div class="action-block">
                            <span class="action-information-block">
                                <span class="action-left-block">&nbsp;&nbsp;</span>
                                    <span class="action-center-block">
                                        <span class="action-info">
                                            <?php echo __l('Action');?>
                                         </span>
                                    </span>
                                </span>
                                <div class="action-inner-block">
                                <div class="action-inner-left-block">
                                    <ul class="action-link clearfix">
                                         <li><?php echo $this->Html->link(__l('Delete'), array('action' => 'delete', $projectRating['ProjectRating']['id']), array('class' => 'delete js-delete', 'title' => __l('Delete')));?></li>
                               		 </ul>
                					</div>
                					<div class="action-bottom-block"></div>
                				  </div>
                          </div>
                    </td>
					<?php if(empty($this->request->params['named']['view_type'])) : ?>
                    <td class="dl">
                        <span class="project-atatus-info project-status-<?php echo $projectRating['Project']['project_status_id']; ?>"><?php echo $this->Html->cText($projectRating['Project']['ProjectStatus']['name'],false);?></span>
                        <?php echo $this->Html->link($this->Html->cText($projectRating['Project']['name']), array('controller'=> 'projects', 'action'=>'view', $projectRating['Project']['slug'], 'admin' => false), array('escape' => false,'title'=>$this->Html->cText($projectRating['Project']['name'],false)));?>
                    </td>
					<?php endif; ?>
                    <td>
                        <?php echo $this->Html->link($this->Html->cText($projectRating['User']['username']), array('controller'=> 'users', 'action'=>'view', $projectRating['User']['username'], 'admin' => false), array('escape' => false,'title'=>$this->Html->cText($projectRating['User']['username'],false)));?>
                    </td>
                    <td>
                    <?php
                      echo $this->Html->link($this->Html->cInt($projectRating['ProjectRating']['rating']), array('controller' => 'projects', 'action' => 'view', $projectRating['Project']['slug'], '#_Ratings','admin' => false), array('escape' => false));?>
                                  </td>
                    <td><?php echo $this->Html->cDateTimeHighlight($projectRating['ProjectRating']['created']);?></td>
                </tr>
                <?php
            endforeach;
        else:
            ?>
            <tr>
                <td colspan="7" class="notice"><?php echo __l('No Votings available');?></td>
            </tr>
            <?php
        endif;
        ?>
    </table>
    <?php
    if (!empty($projectRatings)) :
        ?>
        <?php if(empty($this->request->params['named']['view_type'])) :?>
        <div class="clearfix">
            <div class="admin-select-block grid_left">
                <?php echo __l('Select:'); ?>
                <?php echo $this->Html->link(__l('All'), '#', array('class' => 'js-admin-select-all','title' => __l('All'))); ?>
                <?php echo $this->Html->link(__l('None'), '#', array('class' => 'js-admin-select-none','title' => __l('None'))); ?>
            </div>
            <div class="grid_left admin-checkbox-button">
                <?php echo $this->Form->input('more_action_id', array('class' => 'js-admin-index-autosubmit', 'label' => false, 'empty' => __l('-- More actions --'))); ?>
            </div>
            <?php endif; ?>
            <div class="js-pagination grid_right">
                <?php echo $this->element('paging_links'); ?>
            </div>
        </div>
        <div class="hide">
            <?php echo $this->Form->submit('Submit');  ?>
        </div>
    
        <?php
    endif;
    echo $this->Form->end();
    ?>
</div>